/**
 * 
 */
package com.rapwaves.mc.client.ui;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DecoratedTabPanel;
import com.google.gwt.user.client.ui.Widget;
import com.rapwaves.mc.client.ui.site.SiteDetailsTab;
import com.rapwaves.mc.client.ui.user.UserDetailsTab;

/**
 * @author asanthan
 * 
 */
public class MainPanel extends Composite {

	private static MainPanelUiBinder uiBinder = GWT.create(MainPanelUiBinder.class);

	interface MainPanelUiBinder extends UiBinder<Widget, MainPanel> {
	}

	@UiField
	DecoratedTabPanel tabPanel;

	@UiField
	SiteDetailsTab siteDetailsTab;

	@UiField
	UserDetailsTab userDetailsTab;

	public MainPanel() {
		initWidget(uiBinder.createAndBindUi(this));
		tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {

			@Override
			public void onSelection(SelectionEvent<Integer> event) {
				switch (event.getSelectedItem()) {
				case 0:
					siteDetailsTab.init();
					break;
				case 1:
					userDetailsTab.init();
					break;
				}
			}
		});

	}

}
